import { createRouter, createWebHistory } from "vue-router"
import Home from "../pages/Home.vue"
import About from "../pages/About.vue"
import Temp from '@/components/example.vue'
const routes = [
  {
    path: "/",
    name: "Home",
    component: Temp,
  },
  {
    path: "/about",
    name: "About",
    component: About,
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
})
// 全局前置守卫
router.beforeEach((to, from, next) => {
  console.log(`Navigating from ${from.name} to ${to.name}`)
  next()
})
export default router
